package com.jeesite.modules.em;

import lombok.Getter;

/**
 * 商家任务状态
 */
@Getter
public enum TaskStatus {

    EXAMINEING("0","审核中"),
    ONLINE("1","已上线"),
    DOWNSHELF("2","已下架"),
    EXAMINEFAIL("3","审核失败"),
    VIOLATION("4","违规"),
    YIJIESHU("5","关闭"),
    REFUND("99","申请退款"),
    ;

    private TaskStatus(String code,String message) {
        this.code = code;
        this.message = message;
    }

    private final String code;

    private final String message;

    //遍历枚举V1
    public static TaskStatus getTaskStatusEnum(String code)
    {
        for (TaskStatus element : TaskStatus.values()) {
            if(element.getCode().equalsIgnoreCase(code))
            {
                return element;
            }
        }
        return null;
    }

    //遍历枚举V2
    public static String getTaskStatusSecond(String code)
    {
        for (TaskStatus element : TaskStatus.values()) {
            if(element.getCode().equalsIgnoreCase(code))
            {
                return element.getMessage();
            }
        }
        return null;
    }

}

